define(['jquery', 'bootstrap', 'form'], function($, undefined,  Form) {

    var Controller = {

        index: function() {
            
            require(['bootstrap-datetimepicker'], function() {
                var options = {
                    format: 'YYYY-MM-DD',
                    icons: {
                        time: 'fa fa-clock-o',
                        date: 'fa fa-calendar',
                        up: 'fa fa-chevron-up',
                        down: 'fa fa-chevron-down',
                        previous: 'fa fa-chevron-left',
                        next: 'fa fa-chevron-right',
                        today: 'fa fa-history',
                        clear: 'fa fa-trash',
                        close: 'fa fa-remove'
                    },
                    showTodayButton: true,
                    showClose: true,

                };
                $('.datetimepicker', $("form[role=form]")).parent().css('position', 'relative');
                $('.datetimepicker', $("form[role=form]")).datetimepicker(options).on('dp.change', function(e) {
                    $(this, document).trigger("changed");
                });
            });
            
            $("#common_search").bind("click", function() {
                $("form[role=form]").submit();
            });
        }
    };
    return Controller;

});